var dao = require('../talk.dao.js');

var Cell = function(x, y) {
	this.instance = new dao.GridModel({
		_id: 'g' + x + 'x' + y + 'y',
		gridx: x,
		gridy: y
	});
};

Cell.prototype = new process.EventEmitter();
Cell.prototype.log = function() {
	console.log(JSON.stringify(this.instance));
};


var cell = new Cell(100, 200);
cell.log();

cell.on('refresh', function() {
	console.log('refresh cell...');
});

cell.emit('refresh');